package com.blb.search_service.entity;


import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;
import java.time.LocalDateTime;


/**
 * <p>
 * spu表，该表描述的是一个抽象性的商品，比如 iphone8
 * </p>
 *
 * @author xray
 * @since 2020-09-07
 */
@Data
@Document(indexName = "spu",type = "_doc",shards = 1,replicas = 0)
public class Spu implements Serializable {

    private static final long serialVersionUID=1L;

    /**
     * spu id
     */
    @Id
    private Long id;

    /**
     * 标题
     */
    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    private String title;

    /**
     * 子标题
     */
    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    private String subTitle;

    /**
     * 1级类目id
     */
    @Field(type = FieldType.Long)
    private Long cid1;

    /**
     * 2级类目id
     */
    @Field(type = FieldType.Long)
    private Long cid2;

    /**
     * 3级类目id
     */
    @Field(type = FieldType.Long)
    private Long cid3;

    /**
     * 商品所属品牌id
     */
    @Field(type = FieldType.Long)
    private Long brandId;

    /**
     * 是否上架，0下架，1上架
     */
    @Field(type = FieldType.Boolean)
    private Boolean saleable;

    /**
     * 是否有效，0已删除，1有效
     */
    @Field(type = FieldType.Boolean)
    private Boolean valid;

//    /**
//     * 添加时间
//     */
//    @Field(type = FieldType.Date)
//    private LocalDateTime createTime;
//
//    /**
//     * 最后修改时间
//     */
//    @Field(type = FieldType.Date)
//    private LocalDateTime lastUpdateTime;

    @Field(type = FieldType.Keyword)
    private String category;

    @Field(type = FieldType.Keyword)
    private String brand;

}
